home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Utilities / Text and Speech / TextMaster 1.4 / tm14.shar < prev    next >
Text File  |  1991-05-10  |  24KB  |  660 lines

  1.  
  2.                           TextMaster -- Version 1.4
  3.  
  4. By: Donald Burr
  5.     INTERNET: dburr@ocf.berkeley.edu, 72540.3071@compuserve.COM
  6.     Compu$erve: 72540,3071         America Online: DonaldBurr
  7.  
  8. This is version 1.4 of TextMaster, a UNIX- and Macintosh-end program to
  9. convert text file formats between UNIX and Macintosh.
  10.  
  11. This is a MAJOR bug fix release.  It fixes a bug in the Macintosh version
  12. which will not correctly convert from Macintosh -> UNIX.  Other minor cos-
  13. metic changes and such have been made to both parts of the program,
  14. however.
  15.  
  16. TextMaster will convert between UNIX newlines and Macintosh end-of-line
  17. characters.  Direction of conversion (UNIX -> Mac, or Mac -> UNIX) can be
  18. specified at the command line, and thus files can be converted in any
  19. direction.
  20.  
  21. This is useful if your UNIX -> Mac downloads, or uploads, of text files
  22. are failing miserably.  White Knight has a tendency to do this, and other
  23. comm programs may as well.
  24.  
  25. Please send all comments, bug reports, feature requests, etc. to the
  26. Internet address listed above.
  27.  
  28. This software is being donated to the public domain.  Permission is hereby
  29. granted to freely copy and distribute this source code, as long as no fees
  30. are charged for such duplication.  Permission is also granted to modify
  31. this source code at will, providing that you insert a notice in the dist-
  32. ribution that this source is NOT the original TextMaster source, and that you
  33. not remove my name from the program and accompanying documentation.
  34.  
  35. #! /bin/sh
  36. # This is a shell archive, meaning:
  37. # 1. Remove everything above the #! /bin/sh line.
  38. # 2. Save the resulting text in a file.
  39. # 3. Execute the file with /bin/sh (not csh) to create the files:
  40. #    README
  41. #    MANIFEST
  42. #    BUGS
  43. #    TODO
  44. #    Makefile
  45. #    tm.c
  46. #    tm.h
  47. #    convert.c
  48. #    tm.1
  49. # Wrapped by root@deutsch  on Fri May 10 01:31:26 1991
  50. export PATH; PATH=/bin:$PATH
  51. echo shar: extracting "'README'" '(4521 characters)'
  52. if test -f 'README'
  53. then
  54.     echo shar: will not over-write existing file "'README'"
  55. else
  56. cat << \SHAR_EOF > 'README'
  57.  
  58.                           TextMaster -- Version 1.4
  59.  
  60. By: Donald Burr
  61.     INTERNET: dburr@ocf.berkeley.edu, 72540.3071@compuserve.COM
  62.     Compu$erve: 72540,3071         America Online: DonaldBurr
  63.  
  64. This is version 1.4 of TextMaster, a UNIX- and Macintosh-end program to
  65. convert text file formats between UNIX and Macintosh.
  66.  
  67. This release fixes a MAJOR bug in the Macintosh end.  The Mac end will now
  68. correctly convert files from Mac -> UNIX.
  69.  
  70. TextMaster will convert between UNIX newlines and Macintosh end-of-line
  71. characters.  The direction of conversion can be specified at the command
  72. line, and thus files can be converted in any direction.
  73.  
  74. This is useful if your UNIX -> Mac downloads, or uploads, of text files
  75. are failing miserably.  White Knight has a tendency to do this, and other
  76. comm programs may as well.
  77.  
  78. Please send all comments, bug reports, feature requests, etc. to the
  79. Internet address listed above.
  80.  
  81. This software is being donated to the public domain.  Permission is hereby
  82. granted to freely copy and distribute this source code, as long as no fees
  83. are charged for such duplication.  Permission is also granted to modify
  84. this source code at will, providing that you insert a notice in the dist-
  85. ribution that this source is NOT the original TextMaster source, and that you
  86. not remove my name from the program and accompanying documentation.
  87.  
  88. WHAT IS TEXTMASTER?
  89.  
  90.     It is a utility I hacked together to convert between Macintosh end-
  91. of line characters, and UNIX newlines.  I downloaded a mess of text files
  92. one day to my Mac, and found they all came out on one line, with weird char-
  93. acters (represented by "boxes") between where "line breaks" should have been.
  94. Since I really couldn't download those files again, I decided to write a
  95. utility to help me convert and salvage them.  Thus was born TextMaster, which
  96. was released (up to version 1.3) as "Macify".  Since then, I have found out
  97. that there already is a product called Macify, so in this release, I change
  98. the name to TextMaster.  Nuff said.
  99.  
  100. HOW TO COMPILE IT
  101.  
  102.     First, edit the Makefile.  It is fully commented, and should be
  103. self-explanatory.
  104.  
  105.     Next, edit "tm.h".  The first segment of this file is to set up what
  106. #include file your system uses for string functions.  On SysV, this typically
  107. is <string.h>.  However, if you're on a BSD system, this typically is
  108. <strings.h>.  If you are on MSDOS, Mac, or some other platform, find out
  109. what #include file your string routines are in, or if there is NO include
  110. for string functions, and edit this accordingly.
  111.  
  112.     Next, check over the definitions for characters for EOL's.  These
  113. should remain constant, but just check them over just in case.
  114.  
  115.     Now, simply typing "make" will compile an executable in the current
  116. directory.  Test it out some, and if it seems to work, type "make install",
  117. and a copy of the binary and man pages will be placed in the appropriate
  118. places.
  119.  
  120. USAGE
  121.  
  122.     The man page explains how to use the program, as does the screen
  123. that appears when invoking TextMaster without any arguments.  There isn't
  124. any space here in the README to fully describe it.
  125.  
  126. LAST WORDS
  127.  
  128.     Certainly hope you enjoy this program.  It took a bit of work, es-
  129. pecially the Mac portion of it, but I find it useful.
  130.  
  131.     I am charging no shareware fee or anything for this.  It's free.
  132. Take it, use it in good health.  Modify it at will.  However, when modify-
  133. ing the program, leave the version number intact; just tack on your own
  134. version number after mine.  Example, if the version # of TextMaster is 1.4,
  135. and your name is Bill Smith, and this is the second revision to my code
  136. you have done, change the version number to something like "1.4/BS-2",
  137. the "BS" symbolizing this is Bill Smith's version, and the '2' signifying
  138. this is Bill Smith's 2nd version.  Now you can redistribute the program;
  139. this way, we can keep track of which is the "genuine" version, and so
  140. forth.
  141.  
  142.     Two things I ask if you redistribute this work are, (a) my credit
  143. (name, copyright, etc.) MUST remain in all documentation and program
  144. displays, and (b) You not charge for distribution or shareware fees.
  145.  
  146.     Please email me with all bug reports, suggestions for changes, and
  147. so on.  Better yet, if you have a suggestion for a change or a bug fix or
  148. whatnot, and you can program in C, make the patch yourself, and mail me a
  149. copy of the resultant source code.  If it's good, and I like it, I'll be
  150. sure to include it in my next version, with your name in the credits!  My
  151. email addresses can be found at the beginning of this document.
  152. SHAR_EOF
  153. if test 4521 -ne "`wc -c < 'README'`"
  154. then
  155.     echo shar: error transmitting "'README'" '(should have been 4521 characters)'
  156. fi
  157. chmod +x 'README'
  158. fi # end of overwriting check
  159. echo shar: extracting "'MANIFEST'" '(895 characters)'
  160. if test -f 'MANIFEST'
  161. then
  162.     echo shar: will not over-write existing file "'MANIFEST'"
  163. else
  164. cat << \SHAR_EOF > 'MANIFEST'
  165. *************************************************************************
  166. **                                                                     **
  167. **                   Manifest of Files for TextMaster                  **
  168. **                                                                     **
  169. *************************************************************************
  170.  
  171. FILE NAME    WHAT IT IS
  172. =========    ==========
  173. BUGS        File describing current bugs & incompatibilites of this prog.
  174. MANIFEST    This file.
  175. Makefile    File to be used with "make" to compile this program
  176. README        Read this file for important release information
  177. TODO        Things I'd like to do with this program in the future
  178. convert.c    TextMaster file conversion routine
  179. tm.1        TextMaster man page (nroff -man format)
  180. tm.c        TextMaster main routine
  181. tm.h        TextMaster standard define's
  182. tm.hqx        TextMaster Macintosh version (StuffIt, then BinHex)
  183. SHAR_EOF
  184. if test 895 -ne "`wc -c < 'MANIFEST'`"
  185. then
  186.     echo shar: error transmitting "'MANIFEST'" '(should have been 895 characters)'
  187. fi
  188. chmod +x 'MANIFEST'
  189. fi # end of overwriting check
  190. echo shar: extracting "'BUGS'" '(2075 characters)'
  191. if test -f 'BUGS'
  192. then
  193.     echo shar: will not over-write existing file "'BUGS'"
  194. else
  195. cat << \SHAR_EOF > 'BUGS'
  196. *************************************************************************
  197. **                                                                     **
  198. **              Known Bugs/Incompatibilities with TextMaster           **
  199. **                                                                     **
  200. *************************************************************************
  201.  
  202. (UNIX Version)
  203.  
  204. +  TextMaster will probably barf on non-text input/files (e.g. type special
  205.    files, binaries, etc.)
  206.  
  207. +  TextMaster currently does not support wildcard extension.  A future version
  208.    will incorporate this, as well as allowing you to specify only the
  209.    source filename, in which case the destination filename will auto-
  210.    matically be named [sourcefile].conv.
  211.  
  212. +  If you give it a filename that does not exist, for input, TextMaster will
  213.    most likely either complain or barf.
  214.  
  215. (Macintosh Version)
  216.  
  217. +  TextMaster will barf if the input file is non-text (i.e. application,
  218.    binary, etc.)
  219.  
  220. +  TextMaster NOW CORRECTLY CONVERTS files from Mac -> UNIX.  HOWEVER,
  221.    it saves the converted output file as filetype "????", creator "????".
  222.    Thus, most wordprocessors cannot open it directly.  However, in many
  223.    cases, pressing and holding Option (or, in the case of Microsoft Word,
  224.    pressing and holding Shift) while selecting "Open" will let you open
  225.    these files.  If anyone can fix this so it'll save as TEXT, please
  226.    drop me an E-Mail notice telling what the problem is, and how to
  227.    resolve it!  Thanks!
  228.  
  229. +  TextMaster will overwrite the output file (file.out), if it exists
  230.    already.
  231.  
  232. +  TextMaster curently doesn't support background events, and other such
  233.    Mac-isms.  This will perhaps be integrated in a future version.
  234.  
  235. +  The code for TextMaster is very messy.
  236.  
  237. +  TextMaster does almost NO error-checking.  Thus, if you do something to it
  238.    that it doesn't expect, it'll most likely bomb.
  239.  
  240. +  TextMaster currently saves its output files as type "TEXT" but creator
  241.    "????".  A future upgrade will allow you to specify the file type (MSWD,
  242.    MACA, ttxt, etc.)
  243. SHAR_EOF
  244. if test 2075 -ne "`wc -c < 'BUGS'`"
  245. then
  246.     echo shar: error transmitting "'BUGS'" '(should have been 2075 characters)'
  247. fi
  248. chmod +x 'BUGS'
  249. fi # end of overwriting check
  250. echo shar: extracting "'TODO'" '(2407 characters)'
  251. if test -f 'TODO'
  252. then
  253.     echo shar: will not over-write existing file "'TODO'"
  254. else
  255. cat << \SHAR_EOF > 'TODO'
  256. ************************************************************************
  257. **                                                                    **
  258. **           Things I would Like to Do with this Program              **
  259. **                                                                    **
  260. ************************************************************************
  261.  
  262. If you have any ideas as to how I can accomplish any of these, please
  263. let me know , through E-Mail. (dburr@ocf.berkeley.edu)
  264.  
  265. (UNIX Version)
  266.  
  267. 1.  Getting TextMaster to work with multiple files, processing each indi-
  268.     vidually.  (Using wildcard expansion)
  269.  
  270. 2.  Getting TextMaster to be able to accept only one filename, the "input"
  271.     file.  TextMaster will generate its own name for the outfile, by
  272.     tacking on ".out" or ".conv" or something equally as meaningful
  273.     to the name of the input file.  ("text" becomes "text.out")  This
  274.     will be needed to complete #1, or else you would have to have the
  275.     user prompted for a destination filename each time a new file is
  276.     processed, which is messy.
  277.  
  278. 3.  Possible interface to XMODEM, ZMODEM, or some other protocol, so that
  279.     when you convert files, they automatically get (up)/(down)loaded.
  280.  
  281. 4.  Adding IBM file format support.
  282.  
  283. 5.  I don't know! If you can think of something I can do to improve this,
  284.     let me know through email!
  285.  
  286. (Macintosh Version)
  287.  
  288. 1.  Cleaning up the code some, removing/fixing inconsistencies, duplicates,
  289.     functions not needed, etc.
  290.  
  291. 2.  Allowing you to choose a filename for the output file, instead of
  292.     tacking on the ".out" to the file you open, like it does now.
  293.  
  294. 3.  Adding a better user interface, with a possible Progress dialog box,
  295.     and a dialog that displays when you finish, as well as a dialog that
  296.     pops up if errors occur.
  297.  
  298. 4.  Incorporate error checking in the Mac version.
  299.  
  300. 5.  Making the file type/creator settable (i.e. if you want files to
  301.     come out with filetype "MSWD" for you Microsoft freaks).  Also, fixing
  302.     the Mac -> UNIX transfer so that it will save as filetype "TEXT";
  303.     see BUGS for more details.
  304.  
  305. 6.  Adding IBM file format support in both Mac and UNIX ends.
  306.  
  307. 7.  Incorporating Batch Processing into TextMaster.  This way, you could
  308.     convert a whole folder of files all at the same time.
  309.  
  310. 8.  I don't know!  If you can think of something I can do to improve this,
  311.     let me know through email!
  312. SHAR_EOF
  313. if test 2407 -ne "`wc -c < 'TODO'`"
  314. then
  315.     echo shar: error transmitting "'TODO'" '(should have been 2407 characters)'
  316. fi
  317. chmod +x 'TODO'
  318. fi # end of overwriting check
  319. echo shar: extracting "'Makefile'" '(2304 characters)'
  320. if test -f 'Makefile'
  321. then
  322.     echo shar: will not over-write existing file "'Makefile'"
  323. else
  324. cat << \SHAR_EOF > 'Makefile'
  325. ###########################################################################
  326. ##                                                                       ##
  327. ##                       Makefile for TextMaster                         ##
  328. ##                                                                       ##
  329. ###########################################################################
  330.  
  331. # Values here should be changed to whatever's appropriate for your system
  332.  
  333. # Change this to the C compiler you use.  Most systems will handle 'cc'
  334. # fine, since I didn't write this in ANSI C or anything special.  On some
  335. # systems, GCC may provide better and smaller output, so try that instead.
  336. CC=cc
  337. # Replace this with any compile-time flags you wish to set.
  338. CFLAGS=-O
  339. # This is where the binaries (BINDIR) and man pages (MANDIR) will be installed
  340. # if you type 'make install'.  Change this to whatever's appropriate.
  341. BINDIR=/usr/local
  342. MANDIR=/usr/man/local/man1
  343. # This is the program to be used to install the binaries and man pages.
  344. # I use 'cp' because it's simple, and some versions of 'install' (the system
  345. # built-in installation program) don't work right.
  346. INSTPRG=cp
  347. # This is probably irrelevant; this is the directory that the distribution
  348. # shar-file will be placed.  This is only of use to people re-distributing
  349. # TEXTMASTER, after you've nuked your original copy of the shar file.
  350. DISTDIR=/usr/src/DIST
  351. # Set this to the extension your man pages use.  On some systems, this
  352. # would be "l" (as in L, not 1)
  353. MANEXT=1
  354. # Version number of program, to be used in distribution shell archive
  355. # creation.
  356. VER=14
  357.  
  358. # You should not need to change anything below this line.
  359.  
  360. all:      tm
  361.  
  362. tm:      tm.o convert.o
  363.       $(CC) $(CFLAGS) -o tm tm.o convert.o
  364.  
  365. tm.o:      tm.c tm.h
  366.       $(CC) $(CFLAGS) -c tm.c
  367.  
  368. convert.o:    convert.c tm.h
  369.         $(CC) $(CFLAGS) -c convert.c
  370.  
  371. install:
  372.       $(INSTPRG) tm $(BINDIR)/tm
  373.       $(INSTPRG) tm.1 $(MANDIR)/tm.$(MANEXT)
  374.  
  375. dist:
  376.       shar -cv README MANIFEST BUGS TODO Makefile tm.c \
  377.                    tm.h convert.c tm.1 tm.hqx >tmp.sh
  378.       cat distinfo tmp.sh >$(DISTDIR)/tm$(VER).sh
  379.       /bin/rm -f tmp.sh
  380.  
  381. distmac:    
  382.       shar -cv README MANIFEST BUGS TODO Makefile tm.c \
  383.            tm.h convert.c tm.1 >tmp.sh
  384.       cat distinfo tmp.sh >$(DISTDIR)/tm$(VER)mac.sh
  385.       /bin/rm -f tmp.sh
  386.  
  387. clean:
  388.       /bin/rm -f *.o tmp.sh
  389. SHAR_EOF
  390. if test 2304 -ne "`wc -c < 'Makefile'`"
  391. then
  392.     echo shar: error transmitting "'Makefile'" '(should have been 2304 characters)'
  393. fi
  394. chmod +x 'Makefile'
  395. fi # end of overwriting check
  396. echo shar: extracting "'tm.c'" '(3810 characters)'
  397. if test -f 'tm.c'
  398. then
  399.     echo shar: will not over-write existing file "'tm.c'"
  400. else
  401. cat << \SHAR_EOF > 'tm.c'
  402. /*************************************************************************
  403.  **                                    **
  404.  **                    TM                **
  405.  **                  TextMaster    1.4                **
  406.  **                                    **
  407.  **            By Donald Burr  --  Copyright 1991        **
  408.  **                                    **
  409.  **              Released to the Public Domain            **
  410.  **                                    **
  411.  ** Version History                            **
  412.  **                                    **
  413.  ** Date    Version        Comments                **
  414.  ** ----    -------        --------                **
  415.  ** 10-Mar-91    1.0        Initial release.  Written on a Mac    **
  416.  **                using LightSpeedC, and later uploaded    **
  417.  **                to UNIX, so can't say that it'll work    **
  418.  **                                    **
  419.  ** 14-Mar-91    1.1        Ported to UNIX; discovered bug in usage **
  420.  **                of hex notation.  Fixed up screwy tabs. **
  421.  **                                                                     **
  422.  ** 14-Mar-91    1.2        Cleaned up some more code oddities,     **
  423.  **                split up the code into different files, **
  424.  **                fixed a bug in the character xlation.   **
  425.  **                                                                     **
  426.  ** 15-Mar-91    1.3        Cleaned up some more code; hacked up a  **
  427.  **                real kludgy Mac version; completed work **
  428.  **                on the manpage; added the Mac version   **
  429.  **                (with its own documentation) to the    **
  430.  **                distribution as a BinHex (.hqx) file    **
  431.  **                                    **
  432.  ** 09-May-91    1.4        Sent error messages to stderr.        **
  433.  **                Unified version numbers between both    **
  434.  **                Mac and UNIX versions.  Changed name    **
  435.  **                of program to TextMaster.        **
  436.  **                                    **
  437.  *************************************************************************/
  438.  
  439. #include     <stdio.h>        /* Standard I/O functions */
  440.  
  441. #include    "tm.h"            /* defines for TextMaster */
  442.  
  443. main(argc, argv)        /* main program */
  444. int    argc;
  445. char    *argv[];        /* command line arguments */
  446. {
  447.     char    the_input;    /* input gathered from program */
  448.     int    thing_to_do;    /* tells us what func to perform */
  449.     char    do_the_conversion();    /* this function does the stuff */
  450.     FILE    *infile, *outfile, *fopen();    /* file handlers */
  451.  
  452.     if (argc != 4)        /* are we getting the right # of args? */
  453.     {
  454.         fprintf(stderr,
  455.             "\nTextMaster (tm) v1.4, (c)1991 Donald Burr\n");
  456.         fprintf(stderr,
  457.             "Usage: %s [um or mu] [inputfile or -] ", argv[0]);
  458.         fprintf(stderr, "[outputfile or -]\n", argv[0]);
  459.         fprintf(stderr, "\tum = UNIX -> Macintosh\n");
  460.         fprintf(stderr, "\tmu = Macintosh -> UNIX");
  461.         fprintf(stderr,
  462.             "\n\tinputfile = file to convert FROM, - for stdin\n");
  463.         fprintf(stderr,
  464.             "\toutputfile = file to convert TO, - for stdout\n");
  465.         fprintf(stderr, "\nReleased into the Public Domain\n\n");
  466.         exit(1);
  467.     }
  468.  
  469.     /* Okay, we have the right args, so let's check if they're valid */
  470.  
  471.     if (strcmp(argv[1], "um") == 0)        /* are we doing unix->mac? */
  472.         thing_to_do = 1;        /* 1 = convert unix->mac */
  473.     else if (strcmp(argv[1], "mu") == 0)    /* are we doing mac->unix? */
  474.         thing_to_do = 2;        /* 2 = convert mac->unix */
  475.     else                    /* assume invalid arg */
  476.         {
  477.         fprintf(stderr,
  478.             "\n%s: invalid parameter - <%s>\n", argv[0], argv[1]);
  479.         fprintf(stderr,
  480.             "Was expecting:  mu = Mac -> UNIX translation\n");
  481.         fprintf(stderr,
  482.             "           or:  um = UNIX -> Mac translation\n\n");
  483.         fprintf(stderr, "Halt, cannot proceed.\n\n");
  484.         exit(1);
  485.         }
  486.  
  487.     /* Assign filenames, or stdin/stdout if they are <-> */
  488.  
  489.     if (strcmp(argv[2], "-") == 0)        /* is input == stdin? */
  490.         infile = stdin;            /* directly assign pointer */
  491.     else                    /* assume filename */
  492.         infile = fopen(argv[2], "r");    /* open the file specified */
  493.  
  494.     if (strcmp(argv[3], "-") == 0)        /* is output == stdout? */
  495.         outfile = stdout;        /* directly assign pointer */
  496.     else                    /* assume filename */
  497.         outfile = fopen(argv[3], "w");    /* open for output */
  498.  
  499.     /* Get input char-by-char */
  500.  
  501.     while ((the_input = fgetc(infile)) != EOF)
  502.                     /* while we've still got stuff */
  503.         fputc(do_the_conversion(the_input, thing_to_do), outfile);
  504.                         /* Do the conversion */
  505. }
  506. SHAR_EOF
  507. if test 3810 -ne "`wc -c < 'tm.c'`"
  508. then
  509.     echo shar: error transmitting "'tm.c'" '(should have been 3810 characters)'
  510. fi
  511. chmod +x 'tm.c'
  512. fi # end of overwriting check
  513. echo shar: extracting "'tm.h'" '(830 characters)'
  514. if test -f 'tm.h'
  515. then
  516.     echo shar: will not over-write existing file "'tm.h'"
  517. else
  518. cat << \SHAR_EOF > 'tm.h'
  519. /***************************************************************************
  520.  **                                                                       **
  521.  **                   Special defines for TextMaster                      **
  522.  **                                                                       **
  523.  ***************************************************************************/
  524.  
  525. /* What #include file does your system use for strings? */
  526. #include    <string.h>        /* OK for most SysV machines */
  527. /* #include    <strings.h>        /* OK for most BSD machines */
  528. /* #include    <whatever.h>        /* If none of above, find it! */
  529.  
  530. /* Defines for the charcters we'll be converting */
  531. #define         UNIX_EOL        '\n'    /* UNIX end-of-line character */
  532. #define         MAC_EOL         0x0d    /* Mac end-of-line character */
  533.  
  534. /* That's it! */
  535. SHAR_EOF
  536. if test 830 -ne "`wc -c < 'tm.h'`"
  537. then
  538.     echo shar: error transmitting "'tm.h'" '(should have been 830 characters)'
  539. fi
  540. chmod +x 'tm.h'
  541. fi # end of overwriting check
  542. echo shar: extracting "'convert.c'" '(971 characters)'
  543. if test -f 'convert.c'
  544. then
  545.     echo shar: will not over-write existing file "'convert.c'"
  546. else
  547. cat << \SHAR_EOF > 'convert.c'
  548. /*************************************************************************
  549.  **                                                                     **
  550.  **               Char conversion routine for TextMaster                **
  551.  **                                                                     **
  552.  *************************************************************************/
  553.  
  554. #include <stdio.h>            /* standard I/O functions */
  555.  
  556. #include "tm.h"                /* Program-specific defines */
  557.  
  558. char do_the_conversion(inchar, thing_to_do)
  559. char    inchar;
  560. int    thing_to_do;
  561. {
  562.     if (thing_to_do == 1)        /* Doing UNIX -> Mac? */
  563.     {
  564.         if (inchar == UNIX_EOL)    /* is it the Unix end? */
  565.             return(MAC_EOL);    /* pass back Mac equiv. */
  566.         else
  567.             return(inchar);    /* echo back the char */
  568.     }
  569.     else if (thing_to_do == 2)    /* Doing Mac -> UNIX? */
  570.     {
  571.         if (inchar == MAC_EOL)    /* is it the Mac end? */
  572.             return(UNIX_EOL);    /* pass back UNIX equiv. */
  573.         else
  574.             return(inchar);    /* echo back the char */
  575.     }
  576. }
  577. SHAR_EOF
  578. if test 971 -ne "`wc -c < 'convert.c'`"
  579. then
  580.     echo shar: error transmitting "'convert.c'" '(should have been 971 characters)'
  581. fi
  582. chmod +x 'convert.c'
  583. fi # end of overwriting check
  584. echo shar: extracting "'tm.1'" '(1525 characters)'
  585. if test -f 'tm.1'
  586. then
  587.     echo shar: will not over-write existing file "'tm.1'"
  588. else
  589. cat << \SHAR_EOF > 'tm.1'
  590. .PU
  591. .TH TM 1 "April 05, 1991" "UNIX User's Manual" "Donald Burr"
  592. .SH NAME
  593. tm \- convert text files between Mac and UNIX
  594. .SH SYNOPSIS
  595. .B tm
  596. [mu/um] [inputfile or -] [outputfile or -]
  597. .SH DESCRIPTION
  598. .I tm
  599. converts text files between UNIX and Macintosh formats.  Since
  600. each has its own separate carriage return/line feed conventions,
  601. this is necessary.  
  602. .I tm
  603. should be used ideally in a shell script
  604. or alias, which calls a file transfer program (e.g. 
  605. .I xmodem
  606. .I rz
  607. .I sz
  608. , etc.
  609. .PP
  610. .I tm
  611. takes three (3) arguments.  The first argument is the direction
  612. indicator; it should be "mu" if you wish to convert from Mac to
  613. UNIX, or "um" if you wish to convert from UNIX to Mac.
  614. .PP
  615. The second argument is the filename to take input from.
  616. If a hyphen (-) is specified, 
  617. .I tm
  618.  will take input from stdin
  619. (standard input).  The third, and last, argument to 
  620. .I tm
  621. ,
  622. consists of the filename to direct output to.  If a hyphen
  623. (-) is specified, 
  624. .I tm
  625.  will use standard output (stdout).
  626. If the output file already exists, it will be overwritten.
  627. If the input file doesn't exist, 
  628. .I tm
  629.  will most likely not work.
  630. .PP
  631. .SH "SEE ALSO
  632. xmodem(1), rx(1), rb(1), rz(1), sx(1), sb(1), sz(1), kermit(1)
  633. .SH AUTHOR
  634. Donald Burr
  635. .PP
  636. .SH ADDRESSES
  637. .SH INTERNET:
  638. dburr@ocf.berkeley.edu, 72540.3071@compuserve.COM
  639. .SH COMPU$ERVE:
  640. 72540,3071
  641. .SH "AMERICA ONLINE:
  642. DonaldBurr
  643. .SH LIMITATIONS
  644. .I tm 
  645. only works on one file at a time.  It does not expand wildcards.
  646. This is being worked on; the next version will probably include
  647. this feature.
  648. SHAR_EOF
  649. if test 1525 -ne "`wc -c < 'tm.1'`"
  650. then
  651.     echo shar: error transmitting "'tm.1'" '(should have been 1525 characters)'
  652. fi
  653. chmod +x 'tm.1'
  654. fi # end of overwriting check
  655. #    End of shell archive
  656. echo shar: end of shell archive.
  657. exit 0
  658.